//
//  AdvisoryForVC.m
//  YZZX
//
//  Created by Easaa on 15/6/10.
//  Copyright (c) 2015年 Easaa. All rights reserved.
//

#import "AdvisoryForVC.h"
#import "AdvisoryTableView.h"
#import "QuestionConsultation.h"

@interface AdvisoryForVC ()
{
    AdvisoryTableView  *tableviewlist;
}

@end

@implementation AdvisoryForVC

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"咨询";

    UIView *   NavigationView   = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 88, 44)];
    
   // NavigationView.backgroundColor =[UIColor greenColor];
    
    //右边导航按钮
    self.shaixuan = [UIButton buttonWithType:UIButtonTypeCustom];
    self.shaixuan.frame = CGRectMake(0,4, 40, 35);
    [self.shaixuan setImage:[UIImage imageNamed:@"Activities_NavMeBut"] forState:UIControlStateNormal];
    [self.shaixuan setImage:[UIImage imageNamed:@"Activities_NavMeBut_h"] forState:UIControlStateHighlighted];
    //[self.NavBut setBackgroundColor:[UIColor greenColor]];
    self.shaixuan.tag = 1;
    [self.shaixuan addTarget:self action:@selector(NavButseletor:) forControlEvents:UIControlEventTouchUpInside];
    [NavigationView addSubview:self.shaixuan];
    
    
    
    
    //右边菜单按钮
    
    self.zixunbut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.zixunbut.frame = CGRectMake(44, 4, 40, 35);
    [self.zixunbut setImage:[UIImage imageNamed:@"Activities_Navzixun"] forState:UIControlStateNormal];
    [self.zixunbut setImage:[UIImage imageNamed:@"Activities_Navzixun_h"] forState:UIControlStateHighlighted];
    self.zixunbut.tag = 2;
    //[self.NavButMenu setBackgroundColor:[UIColor redColor]];
    [self.zixunbut addTarget:self action:@selector(NavButseletor:) forControlEvents:UIControlEventTouchUpInside];
    [NavigationView addSubview:self.zixunbut];
    
    //
    //    MenuView = [[UIView alloc]initWithFrame:CGRectMake(0, 64, 100, 150)];
    //    MenuView.backgroundColor = [UIColor grayColor];
    //    [self.view addSubview:MenuView];
    //    MenuView.hidden = YES;
    
    
    UIBarButtonItem *negativeSpacerRight = [[UIBarButtonItem alloc]
                                            
                                            initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                            
                                            target:nil action:nil];
    
    /**
     
     *  width为负数时，相当于btn向右移动width数值个像素，由于按钮本身和边界间距为5pix，所以width设为-5时，间距正好调整
     
     *  为0；width为正数时，正好相反，相当于往左移动width数值个像素
     
     */
    
    negativeSpacerRight.width = -15;
    
    UIBarButtonItem *rightBarBtItem = [[UIBarButtonItem alloc] initWithCustomView: NavigationView];
    
    self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:negativeSpacerRight, rightBarBtItem, nil];
    

    

    
    
    self.view.backgroundColor =RGBCOLOR(230, 230, 230);

    tableviewlist =[[AdvisoryTableView alloc]initWithActionFantionFram:CGRectMake(0, 0, Dev_ScreenWidth, Dev_ScreenHeight-64) Activitiesid:self.DataMassgeModel.id_massge];//@"1142"];
    tableviewlist.DelegatMessage =self;
    tableviewlist.labelTitle.text = self.DataMassgeModel.Title;

    [self.view addSubview:tableviewlist];
    
}



- (void)NavButseletor: (UIButton *)but
{
    if(but.tag == 2)
    {
        QuestionConsultation  *QuestiomView =[[QuestionConsultation alloc]init];
        QuestiomView.tableviewsdegat = tableviewlist;
        QuestiomView.id_massge = (NSInteger)self.DataMassgeModel.id_massge;
        [self.navigationController pushViewController:QuestiomView animated:YES];
    
    }else if (but.tag == 1)
    {
    
        [tableviewlist creaMeDataZuxun];
    
    }
        

}



@end
